<template>
  <view>
    <view class="my-search-container" :style="{'background-color':bgColor}" @click="searchBoxHandler">
        <view class="my-search-box" :style="{'border-radius':radius+'px'}">
             <uni-icons type="search"></uni-icons>
             <text class="placeholder">搜索</text>
        </view>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    props:{
      //搜索框的背景颜色
      bgColor:{
        type:String,
        default:'#C00000'
      },
      //圆角尺寸
      radius:{
        type:Number,
        default:18  //单位是px
      }
    },
    data() {
      return {
        
      };
    },
    methods:{
      //为自定义组件绑定click事件
      searchBoxHandler() {
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
.my-search-container {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 10px;
  .my-search-box{
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 100%;
    background-color: #FFFFFF;
    .placeholder{
       font-size: 15px;
       margin-left: 5px;
    }
  }
}
</style>
